<?php $url = new Url();?>
<link rel="stylesheet" type="text/css" href="<?=Yii::app()->params["urlRs"] ?>/js/colorbox/colorbox.css" media="all" /> 
<script  src="<?=Yii::app()->params["urlRs"] ?>/js/colorbox/jquery.colorbox.js" type="text/javascript"></script> 
<div id="main">
    <div id="sidebar">
        <h3>Thời gian</h3>
        <p><span class="icon icon-time"><?php echo $total_time; ?> giờ</span></p>
        <p>
            <a href="<?php echo $url->createUrl("task/index"); ?>">Chi tiết</a> |
            <a href="<?php echo $url->createUrl("gantt/index"); ?>">Biểu đồ</a></p>
    </div>

    <div id="content">
        <?php if($_SESSION['project_pm']['project_admin_id'] == $_SESSION['user_pm']['user_id']){ ?>
            <div class="contextual">
                <?php if($_SESSION['project_pm']['project_status'] == 1){ ?>
                    <a rel="nofollow" id="open_pop" class="icon icon-lock" href="#popup_status_project" >Đóng dự án</a>
                    <?php }else{ ?>
                    <a rel="nofollow" id="open_pop" class="icon icon-unlock" href="#popup_status_project">Mở lại dự án dự án</a>
                    <?php } ?>
            </div>
            <?php } ?>
        <h2>Tổng quan</h2>

        <div class="splitcontentleft">
            <div class="wiki">
                <p><?php echo $_SESSION['project_pm']['project_description']; ?></p>
                <ul>
                    <li>Trang chủ: <a href="<?php echo $_SESSION['project_pm']['project_homepage']; ?>"><?php echo $_SESSION['project_pm']['project_homepage']; ?></a></li>
                    <li>Công ty: <a href=""><?php echo $_SESSION['project_pm']['project_company']; ?></a></li>
                    <li>Khách hàng: <a href=""><?php echo $_SESSION['project_pm']['project_customer']; ?></a></li>
                    <li>Ngày bắt đầu dự án: <a href="javascript:"><?php echo date('d/m/Y',$_SESSION['project_pm']['project_start_date']); ?></a></li>
                    <li>Ngày dự kiến kết thúc dự án: <a href="javascript:"><?php echo date('d/m/Y',$_SESSION['project_pm']['project_end_date']); ?></a></li>
                    <li>Ngân sách dự án: <a href="javascript:"><?php echo number_format($_SESSION['project_pm']['project_budget'],0); ?></a></li>
                    <li>Ngân sách còn lại: <a href="javascript:"><?php echo number_format($data_project['project_remain']); ?></a></li>
                </ul>                
            </div>            

            <!--<div class="issues box">
            <h3>Vấn đề</h3>
            <ul>
            <li><a href="javascript:">Bug</a>:
            3 open / 3
            </li>
            <li><a href="javascript:">Feature</a>:
            6 open / 7
            </li>
            <li><a href="javascript:">Support</a>:
            0 open / 0
            </li>
            </ul>
            <p>
            <a href="<?php echo $url->createUrl("task/index"); ?>">Tất cả công việc</a>
            | <a href="<?php echo $url->createUrl("gantt/index"); ?>">Biểu đồ sự kiện</a>
            </p>
            </div>-->

        </div>

        <div class="splitcontentright">
            <div class="members box">
                <h3>Thành viên</h3>
                <p>                    
                    Quản lý dự án: <a href="<?php echo $url->createUrl("user/detail",array("user_id"=>$_SESSION['project_pm']['project_admin_id'])); ?>"><?php echo $_SESSION['project_pm']['fullname']; ?></a><br>                                        
                    Thành viên: <?php for($i=0;$i<count($data_member);$i++){ ?> <a href="<?php echo $url->createUrl("user/detail",array("user_id"=>$data_member[$i]['user_id'])); ?>"><?php echo $data_member[$i]['fullname']; ?></a>, <?php } ?><br>
                </p>
            </div>
        </div>
        <div style="clear:both;"></div>
        <div style="width: 50%;margin: 0px auto;padding-top: 30px;">            
            <img style="max-width: 400px;max-height: 400px;" src="<?=Yii::app()->params["urlImage"].$_SESSION['project_pm']['project_image']; ?>" />
        </div>
    </div>

</div>

<div style="display: none;">
    <div id="popup_status_project" style="margin: 8px;">        
        <div class="box tabular">            
            <p>
            <label for="version_description" style="width:100px;">Lý do</label>            
            <textarea cols="" rows="" name="version[description]" id="reason" style="width: 220px;height: 90px;"></textarea>
            </p>
        </div>
        <?php if($_SESSION['project_pm']['project_status'] == 1){ ?>        
            <input type="button" value="Thực hiện" name="commit" onclick="change_status_project(0)">
            <?php }else{ ?>                    
            <input type="button" value="Thực hiện" name="commit" onclick="change_status_project(1)">
            <?php } ?>        
    </div>                     
</div>

<script type="">

    $(document).ready(function(){                    
        $("#open_pop,#open_pop_2").colorbox({inline:true,width:"450px", height:"200px",opacity:0.1,onLoad: function(){  
                $('#cboxClose').remove();              
            }        
        });                

    });

    function change_status_project(status){
        var reason = $('#reason').val();
        if(confirm('Bạn có chắc chắn muốn thay đổi trạng thái dự án?')){
            var strUrl = '<?=$url->createUrl("project/ajaxUpdateStatusProject") ?>';            
            loadingAjax();
            $.ajax({
                type: "GET",
                url: strUrl,
                data: {status:status,reason:reason},
                success: function(msg){                            
                    alert(msg);
                    if(msg==1){                       
                        //$('#role_row_'+role_id).hide('slow');
                        location.reload();
                    }
                }
            });
            location.reload();
            closeLoadingAjax();            
        }
    }

</script>
